/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.google.code.smon.pers;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author xero
 */
@Entity
@Table(name = "server_actions")
@NamedQueries({
    @NamedQuery(name = "ServerActions.findAll", query = "SELECT s FROM ServerActions s")})
public class ServerActions implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "action")
    private String action;
    @JoinColumn(name = "server_id", referencedColumnName = "id")
    @ManyToOne
    private Server serverId;

    public ServerActions() {
    }

    public ServerActions(Integer id) {
        this.id = id;
    }

    public ServerActions(Integer id, String action) {
        this.id = id;
        this.action = action;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public Server getServerId() {
        return serverId;
    }

    public void setServerId(Server serverId) {
        this.serverId = serverId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ServerActions)) {
            return false;
        }
        ServerActions other = (ServerActions) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.google.code.smon.pers.ServerActions[ id=" + id + " ]";
    }
    
}
